#ifndef ROBORTS_DECISION_ATTACK_BEHAVIOR_H
#define ROBORTS_DECISION_ATTACK_BEHAVIOR_H

#include "io/io.h"

#include "../blackboard/blackboard.h"
#include "../behavior_tree/behavior_state.h"
#include "../behavior_tree/behavior_node.h"
#include "roborts_msgs/ShootCmd.h"
#include "../proto/decision.pb.h"

#include "line_iterator.h"

namespace roborts_decision {
class AttackBehavior {
 public:
  AttackBehavior(Blackboard* &blackboard):blackboard_(blackboard) {

    ros::service::waitForService("cmd_shoot");	

  }

  void Run() {
    if(!blackboard_->attack_condition())
    {
      return ;
    }
    ros::ServiceClient attack_client = nh.serviceClient<roborts_msgs::ShootCmd>("cmd_shoot");
    roborts_msgs::ShootCmd srv;
    srv.request.mode = 1;
    srv.request.number = 1;
    attack_client.call(srv);
    std::cout<<"call"<<std::endl;
  }

  ~AttackBehavior() = default;

 private:
  //! perception information
  Blackboard* const blackboard_;
  ros::NodeHandle nh;
  ros::ServiceClient attack_client;

};
}


#endif //ROBORTS_DECISION_ATTACK_BEHAVIOR_H
